home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Concept 6
/
CD Concept 06.iso
/
mac
/
UTILITAIRE
/
Little Smalltalk v3.1.4
/
C Source
/
Sources
/
CLStDoc.cp
< prev
next >
Wrap
Text File
|
1994-10-15
|
4KB
|
133 lines
//=============================================================================
// Little Smalltalk, version 3
// Written by Tim Budd, Oregon State University, July 1988
//
// Symantec Think Class Library interface code
// ⌐Julian Barkway, April 1994, all rights reserved.
//
// CLStDoc.cp
// ----------
// This class provides basic document related functions.
//
// v3.1.2 - Minimum window size decreased to 75x75
//=============================================================================
#include <string.h>
#include "Global.h"
#include "Commands.h"
#include "CApplication.h"
#include "CBartender.h"
#include "CDataFile.h"
#include "CDecorator.h"
#include "CDesktop.h"
#include "CError.h"
#include "CPanorama.h"
#include "TBUtilities.h"
#include "CLStDoc.h"
#include "CTextPane.h"
#include "CLStWindow.h"
#include "CLStApp.h"
#include "LStResources.h"
#define LSTWIN_MIN 75
extern CApplication *gApplication; /* The application */
extern CBartender *gBartender; /* The menu handling object */
extern CDecorator *gDecorator; /* Window dressing object */
extern CDesktop *gDesktop; /* The enclosure for all windows */
extern CBureaucrat *gGopher; /* The current boss in the chain of command */
extern OSType gSignature; /* The application's signature */
extern CError *gError; /* The error handling object */
extern CLStApp *gSmalltalk;
//==============================================================================
// Initialise a Document object.
//==============================================================================
void CLStDoc::ILStDoc (CApplication *super, Boolean printable)
{
CDocument::IDocument (super, printable);
}
//==============================================================================
// Make a window.
//==============================================================================
CWindow *CLStDoc::BuildWindow (char *title, Point *wPosition, Point *wSize)
{
Str255 wTitle;
Rect sr;
itsWindow = new (CLStWindow);
itsWindow->IWindow (WTemplate, FALSE, gDesktop, this);
if (title != NULL) {
strcpy ((char *)wTitle, title);
CtoPstr ((char *)wTitle);
itsWindow->SetTitle (wTitle);
}
SetRect (&sr, LSTWIN_MIN, LSTWIN_MIN,
screenBits.bounds.right, screenBits.bounds.bottom);
itsWindow->SetSizeRect (&sr);
gDecorator->PlaceNewWindow (itsWindow);
if (wPosition != NULL)
itsWindow->Move (wPosition->h, wPosition->v);
if (wSize != NULL)
itsWindow->ChangeSize (wSize->h, wSize->v);
itsWindow->Select ();
((CLStWindow *)itsWindow)->itsDocument = this;
return itsWindow;
}
//==============================================================================
// Set the file type for this document. Allows specification of types other than
// 'TEXT'
//==============================================================================
void CLStDoc::SetFileType (long fType)
{
fileType = fType;
}
//==============================================================================
// Return the document's window.
//==============================================================================
CWindow *CLStDoc::GetWindow (void)
{
return itsMainPane->GetWindow ();
}
//==============================================================================
// Process the standard file requester.
//==============================================================================
void CLStDoc::AskFileName (char *promptString, Boolean save, StandardFileReply *sfReply,
SFTypeList fTypes, short numFTypes)
{
Point location;
Str255 str;
if (save) {
strcpy ((char *)str, promptString);
CtoPstr ((char *)str);
StandardPutFile (str, "\p", sfReply);
}
else
StandardGetFile (NULL, numFTypes, fTypes, sfReply);
}
//={OVERRIDE}==================================================================
// Close confirmation handled by Smalltalk.
//=============================================================================
Boolean CLStDoc::ConfirmClose (Boolean quitting)
{
return TRUE;
}